package com.example.contentprovidertest;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

/**
 * Created by 鏈濊姳鍋忎笉澶曟嬀 on 2017/1/6.
 */

public class DbHelper extends SQLiteOpenHelper{
    /**
     *
     * @param context   涓婁笅鏂�
     * @param name      鍚嶅瓧锛堟暟鎹簱鍚嶅瓧锛屾枃浠跺悕锛�
     * @param factory   娓告爣宸ュ巶  澶氭暟鎯呭喌锛歯ull
     * @param version   鏁版嵁搴撶殑鐗堟湰
     */
    //鏋勯�犳柟娉�
    public DbHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
        Log.i("test","鏋勯��");
    }
    //鍒涘缓
    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        //鎿嶄綔锛氬垱寤鸿〃鐨勬搷浣�
        Log.i("test","鍒涘缓琛�");
        sqLiteDatabase.execSQL("create table person(_id integer primary key autoincrement,name,age)");
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
        Log.i("test","鏁版嵁搴撶増鏈紝浣�--->楂�");
    }



//
//    public DbHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
//        super(context, name, factory, version);
//    }
//
//    @Override
//    public void onCreate(SQLiteDatabase sqLiteDatabase) {
//
//    }
//
//    @Override
//    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
//
//    }

}
